# -*- coding: utf-8 -*-
# TencentBlueKing is pleased to support the open source community by making
# 蓝鲸智云 - PaaS 平台 (BlueKing - PaaS System) available.
# Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the MIT License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
#     http://opensource.org/licenses/MIT
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language governing permissions and
# limitations under the License.
#
# We undertake not to change the open source license (MIT license) applicable
# to the current version of the project delivered to anyone in the future.

# Generated by Django 3.2.12 on 2022-07-20 08:36

from django.db import migrations, models
import django.db.models.deletion
import paas_wl.utils.models


class Migration(migrations.Migration):

    dependencies = [
        ('specs', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='AppModelDeploy',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('region', models.CharField(help_text='部署区域', max_length=32)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('application_id', models.UUIDField(verbose_name='所属应用')),
                ('module_id', models.UUIDField(verbose_name='所属模块')),
                ('environment_name', models.CharField(choices=[('stag', '预发布环境'), ('prod', '生产环境')], max_length=16, verbose_name='环境名称')),
                ('name', models.CharField(max_length=32, verbose_name='Deploy 名称')),
                ('status', models.CharField(blank=True, choices=[('pending', '待实施'), ('progressing', '进行中'), ('ready', '已就绪'), ('error', '错误'), ('unknown', '未知')], max_length=32, null=True, verbose_name='状态')),
                ('reason', models.CharField(blank=True, max_length=128, null=True, verbose_name='状态原因')),
                ('message', models.TextField(blank=True, null=True, verbose_name='状态描述文字')),
                ('last_transition_time', models.DateTimeField(null=True, verbose_name='状态最近变更时间')),
                ('operator', paas_wl.utils.models.BkUserField(blank=True, db_index=True, max_length=64, null=True, verbose_name='操作者')),
            ],
        ),
        migrations.AddIndex(
            model_name='appmodelresource',
            index=models.Index(fields=['application_id', 'module_id'], name='specs_appmo_applica_e4579a_idx'),
        ),
        migrations.AddIndex(
            model_name='appmodelrevision',
            index=models.Index(fields=['application_id', 'module_id'], name='specs_appmo_applica_501862_idx'),
        ),
        migrations.AddField(
            model_name='appmodeldeploy',
            name='revision',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='specs.appmodelrevision'),
        ),
        migrations.AlterUniqueTogether(
            name='appmodeldeploy',
            unique_together={('application_id', 'module_id', 'environment_name', 'name')},
        ),
    ]
